package zzk.mcp1;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.mcp.SyncMcpToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName McpClientConfiguration
 * @Description
 * @Author weizou.zou
 * @Date 2025/4/9 0:41
 * @Version $
 */
@Configuration
public class McpClientConfiguration {
    /**
     * 注入ChatClient
     *
     * @param chatModel
     * @param toolCallbackProvider 报红不用管，没有任何问题
     * @return
     */
    @Bean
    ChatClient chatClient(ChatModel chatModel, SyncMcpToolCallbackProvider toolCallbackProvider) {
        return ChatClient
                .builder(chatModel)
                .defaultTools(toolCallbackProvider.getToolCallbacks())
                .build();
    }
}
